// component/downloadQuote/downloadQuote.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    detail: Object
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    offerDown() {
      let that = this
      let url = this.data.detail.url
      wx.$https('offer.down', {
        offerId: this.data.detail.offerId
      }).then(res => {
        wx.showLoading({
          mask: true
        })
        wx.downloadFile({
          url: url,
          success(res) {
            let filePath = res.tempFilePath;
            wx.openDocument({
              filePath: filePath,
              fileType: "xls",
              success(res) {
                wx.hideLoading()
              }
            });
          }
        })
      })
    },
  }
})